package com.pie4cloud.pie.job.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.List;

@Data
@Entity
@Table(name = "T_DATA_PLAYBILL")
@DiscriminatorValue("PLAYBILL")
@EqualsAndHashCode(callSuper=true)
public class PlaybillEntity extends JobInfoEntity{
	@Id
	@Column(name = "ID",length = 11)
	@TableId(value = "Id", type = IdType.ASSIGN_ID)
	@GenericGenerator(name="snowflakeId", strategy="com.pie4cloud.pie.jpa.id.GenerateSnowflakeId")
	@GeneratedValue(generator="snowflakeId")
	@ApiModelProperty(value="id")
	private Long id;

	@Column(name = "database_id", length = 50)
	private String databaseId;

	@Column(name = "table_name", length = 50)
	private String tableName;
    //资料四级编码
	@Column(name = "d_data_id", length = 50)
	private String ddataId;
	//资料存储编码
	@Column(name = "d_data_class_id", length = 50)
	private String ddataClassId;
	//资料名称
	@Column(name = "data_name", length = 50)
	private String dataName;
	//及时时间
	@Column(name = "timely", length = 50)
	private long timely;

	@Column(name = "min_file_num", length = 50)
	private Integer minFileNum;


	//是否应收一致 0一致 1不一致
	@Column(name = "is_fit", length = 50)
	private Integer isFit;



	@OneToMany(targetEntity =ReceivableEntity.class, cascade = CascadeType.ALL,fetch = FetchType.EAGER)
	@JoinColumn(name = "playbill_id")
	@OrderBy("id")
	private List<ReceivableEntity> recs;

    @Transient
	private Boolean isManual=false;



}
